package com.fhz.circle.manager;

import android.content.Context;
import android.util.Patterns;
import android.view.Gravity;

import com.fhz.circle.R;
import com.fhz.circle.widget.DialogView;

/**
 * 时间:11/14/21
 *
 * @author msfeng
 * 简述: 提示对话框管理类
 */
public class DialogManager {
    private static volatile DialogManager dialogManager = null;

    private DialogManager(){}

    public static DialogManager getInstance(){
        if(dialogManager == null){
            synchronized (DialogManager.class){
                if(dialogManager == null){
                    dialogManager = new DialogManager();
                }
            }
        }
        return dialogManager;
    }

    public DialogView createDialog(Context context,int layout,int gravity){
        return new DialogView(context,layout, R.style.DialogTheme,gravity);
    }


    public DialogView createDialog(Context context,int layout){
        return new DialogView(context,layout, R.style.DialogTheme, Gravity.CENTER);
    }

    public void show(DialogView dialogView){
        if(dialogView != null){
            if(!dialogView.isShowing()){
                dialogView.show();
            }
        }
    }

    public void hide(DialogView dialogView){
        if(dialogView != null){
            if(dialogView.isShowing()){
                dialogView.dismiss();
            }
        }
    }
}
